package com.web3.management.repository;

import com.web3.management.entity.TmCommand;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface TmCommandRepository extends JpaRepository<TmCommand, Integer> {

    List<TmCommand> findTop20ByClientIdAndStatusOrderByCreatedAtAsc(String clientId, String status);

    List<TmCommand> findByAccountIdOrderByCreatedAtDesc(Integer accountId);

    long countByClientIdAndStatus(String clientId, String status);

    long countByAccountIdAndStatus(Integer accountId, String status);

    List<TmCommand> findByClientIdAndAckAtAfter(String clientId, Date ackAt);
}
